#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

void solve() {
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    int ans1 = 0, ans2 = 0;
    for(int i = 0; i < n; i++) {
        if(s[i] != t[i]) {
            if(s[i] == '1') ans1++;
            else ans2++;
        } 
    }
    cout << abs(ans1 - ans2) << endl;
}

int main() {
    int t;
    cin >> t;
    while(t--) solve();
    return 0;
}